package com.haiya.factory.simple.pizza;

/**
 * @author qiaoguoqiang
 */
public class SimplePizzaFactory {
    /**
     * 根据orderType返回对应的Pizza类型
     * @param orderType
     * @return
     */
    public Pizza createPizza(String orderType) {
        System.out.println("实用简单工厂模式生产披萨");
        Pizza pizza = null;
        if (orderType.equals("greek")) {
            pizza = new GreekPizz();
            pizza.setName("希腊披萨");
        } else if (orderType.equals("cheese")) {
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        } else if (orderType.equals("pan")) {
            pizza = new PanPizza();
            pizza.setName("烤盘披萨");
        }

        return pizza;
    }
}
